<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>treegrid</title>
    <link href="/themes/icon.css" rel="stylesheet" type="text/css" >
    <link href="/themes/default/easyui.css" rel="stylesheet" type="text/css" >
    <script src="/js/jquery.min.js"></script>
    <script src="/js/jquery.easyui.min.js"></script>
    <script src="/js/easyui-lang-zh_CN.js"></script>
</head>
<body>
    <table id="tg"  >
    </table>
    <script>
        $(function(){
            $('#tg').treegrid({
                url:'tree.json',
                method:'get',
               
                rownumbers:true,
                idField:'id',
                treeField:'name',  //定义树节点字段(节点显示的文字)
                columns:[[
                    { field: 'id', title: "ID", checkbox: true },
                    { field: 'name', title: "名称", width: 230 },
                    { field: 'sort', title: "排序", width: 50 },
                    { field: 'is_leaf', title: "叶子节点", hidden: true, width: 50 },
                    { field: 'status', title: "状态", formatter: formatter_status, width: 50 },
                    { field: 'create_time', title: "创建时间", width: 200 },
                    { field: '_parentId', title: "父节点", hidden: true, width: 100 },
                    { field: 'tenement', title: "当前隶属", width: 100 }, //TODO:当前隶属列仅仅系统管理可见
                    { field: 'manager', title: "经理", width: 200 },
                    { field: 'leaders', title: "其他领导", width: 200 },
                    { field: 'persons', title: "人数", width: 100 },
                ]]
            });
        });

        function formatter_status(value, row, index) {
                //1.正常  0.禁用 
                if (value == 1) {
                    return "启用";
                } else {
                    return "禁用";
                }
        }
    </script>
</body>
</html>